﻿using GN.Pay.TradeChannel.ProtocolPay;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.TradeChannel.Gyb.Response
{
    /// <summary>
    /// 协议支付响应
    /// </summary>
    [Serializable]
    class ProtocolBindResponse : AXmlResponse
    {
        public ProtocolBindResponse(string responseString,
            ITradeChannel channel,
            GybConfigure config) : base(responseString, channel, config)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        public string TranAbbr { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string ProtocolNo { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string TelPhone { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 支付单笔限额
        /// </summary>
        public string TransLimit { get; set; }

        /// <summary>
        /// 支付单日限额
        /// </summary>
        public string TransDayLimit { get; set; }

        /// <summary>
        /// 签约类型
        /// </summary>
        public string SignType { get; set; }

        /// <summary>
        /// 签约时间
        /// </summary>
        public string SignDate { get; set; }

        /// <summary>
        /// 解约时间
        /// </summary>
        public string EndDate { get; set; }

        /// <summary>
        /// 签约状态
        /// </summary>
        public string TransStatus { get; set; }

        /// <summary>
        /// 转为结果
        /// </summary>      
        /// <returns></returns>
        public IProtocolBindApplyResult ToResult(IProtocolBindApply apply)
        {
            return new ProtocolBindApplyResult()
            {
                AccountName = apply.AccountName,
                AccountNo = apply.AccountNo,
                AccountType = BankAccountType.Debit,
                BankNo = "GYB",
                CreditCardLastNo = null,
                CreditCardLastTerm = null,
                IdentityNo = apply.IdentityNo,
                MemberId = apply.MemberId,
                MobilePhone = apply.MobilePhone,
                OpenBankCity = null,
                OpenBankName = null,
                ProtocolNo = ProtocolNo,
                State = ProtocolApplyResultState.Success,
                StateMessage = "申请成功"
            };
        }

    }
}
